<template>
    <el-dialog
            title="修改名称"
            :visible.sync="dialogVisible"
            width="30%"
            :append-to-body="true"
    >
        <Editor :value="titleHtml" :readOnly="disabledVal"
                :minHeight="300" @input="(html) => titleHtml = html"></Editor>

        <div style="margin-top: 20px;display: flex;justify-content: center">
            <el-button @click="saveValue" type="primary">保存</el-button>
        </div>
    </el-dialog>
</template>

<script>
import Editor from "@/components/Editor/index.vue";

export default {
    name: "dialogEditor",
    components: {
        Editor
    },
    data() {
        return {
            dialogVisible:false,
            titleHtml:'',
            disabledVal:false
        }
    },
    methods:{
        openDialog(str){
            this.dialogVisible = true
            this.titleHtml = str
        },
        openReadonlyDialog(str){
            this.dialogVisible = true
            this.titleHtml = str
            this.disabledVal = true
        },
        saveValue(){
            this.dialogVisible = false
            this.$message.success('保存成功')
            this.$emit('throwHtml',this.titleHtml)
        }
    }
}
</script>

<style scoped>

</style>